<?php

use yii\db\Migration;

/**
 * Handles the creation of table `code`.
 */
class m180915_044044_create_code_table extends Migration
{
    public $tableName = '{{%code}}';

    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable($this->tableName, [
            'id' => $this->primaryKey(),
            'goods_sn' => $this->char(4)->notNull()->comment('产品识别码'),
            'security_sn' => $this->char(10)->notNull()->comment('防伪码'),
            'bar_code' => $this->char(10)->notNull()->comment('条形码'),
            'identity_code' => $this->char(10)->notNull()->comment('身份码'),
            'status' => $this->tinyInteger(1)->notNull()->comment('使用状态'),
            'link' => $this->string(1000)->notNull()->defaultValue('')->comment('二维码连接'),
            'created_at' => $this->integer(11)->notNull()->comment('创建时间'),
            'updated_at' => $this->integer(12)->notNull()->comment('修改时间'),
        ]);

    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('code');
    }
}
